extends Control

func _ready():
	# 设置按钮事件监听
	$VBoxContainer/StartButton.pressed.connect(_on_start_button_pressed)
	$VBoxContainer/SettingsButton.pressed.connect(_on_settings_button_pressed) 
	$VBoxContainer/QuitButton.pressed.connect(_on_quit_button_pressed)
	
	# 设置初始焦点(用于键盘/手柄控制)
	$VBoxContainer/StartButton.grab_focus()
	
	# 播放背景音乐
	if !Music.get_playing_track():
		Music.play(load("res://assets/music/main_theme.mp3"))

func _on_start_button_pressed():
	await Transition.cover()
	get_tree().change_scene_to_file("res://src/main.tscn") 
	await Transition.clear()

func _on_settings_button_pressed():
	# TODO: 打开设置面板
	pass

func _on_quit_button_pressed():
	get_tree().quit()
